#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
	int i = 0;
	char ch = 0;
	while ((ch = getchar()) != '#')
	{
		switch (ch)
		{
		case '.':ch = '!'; putchar(ch); i++; break;
		case '!':printf("!!"); i++; break;
		default:putchar(ch);
		}
	}
	printf("%d", i);

	return 0;
}